package com.nageoffer.shortlink.remote;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nageoffer.shortlink.common.convention.result.Result;
import com.nageoffer.shortlink.common.dto.project.req.*;
import com.nageoffer.shortlink.common.dto.project.resp.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value="short-link-project")
public interface ShortLinkClient {
    @PostMapping("/api/short-link/create")
    Result<ShortLinkCreateRespDTO> createShortLink(@RequestBody ShortLinkCreateReqDTO reqParam);
    @GetMapping("/api/short-link/page")
    Result<Page<ShortLinkPageRespDTO>> getShortLinkPage(@RequestParam("gid") String gid,
                                                        @RequestParam("orderTag") String orderTag,
                                                        @RequestParam("current") Long current,
                                                        @RequestParam("size") Long size);
    @GetMapping("/api/short-link/count")
    Result<List<ShortLinkGroupCountRespDTO>> groupShortLinkCount(@RequestParam("reqParam") List<String> reqParam);
    @GetMapping("/api/short-link/title")
    Result<String> getTitleByUrl(@RequestParam("url")String url);
    @PostMapping("/api/short-link/create/batch")
    Result<ShortLinkBatchCreateRespDTO> createBatchShortLink(@RequestBody ShortLinkBatchCreateReqDTO reqParam);

    @PutMapping("/api/short-link/update")
    Result<Void> updateShortLink(@RequestBody ShortLinkUpdateReqDTO reqParam);

    @GetMapping("/api/short-link/stats")
    Result<ShortLinkStatsRespDTO> shortLinkStats(@SpringQueryMap ShortLinkStatsReqDTO requestParam);

    @GetMapping("/api/short-link/stats/access-record")
    Result<Page<ShortLinkStatsAccessRecordRespDTO>> pageShortLinkStats(@SpringQueryMap ShortLinkStatsAccessRecordReqDTO requestParam);


}
